# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Dataform.V1beta1.Model.IncrementalTableConfig do
  @moduledoc """
  Contains settings for relations of type `INCREMENTAL_TABLE`.

  ## Attributes

  *   `incrementalPostOperations` (*type:* `list(String.t)`, *default:* `nil`) - SQL statements to be executed after inserting new rows into the relation.
  *   `incrementalPreOperations` (*type:* `list(String.t)`, *default:* `nil`) - SQL statements to be executed before inserting new rows into the relation.
  *   `incrementalSelectQuery` (*type:* `String.t`, *default:* `nil`) - The SELECT query which returns rows which should be inserted into the relation if it already exists and is not being refreshed.
  *   `refreshDisabled` (*type:* `boolean()`, *default:* `nil`) - Whether this table should be protected from being refreshed.
  *   `uniqueKeyParts` (*type:* `list(String.t)`, *default:* `nil`) - A set of columns or SQL expressions used to define row uniqueness. If any duplicates are discovered (as defined by `unique_key_parts`), only the newly selected rows (as defined by `incremental_select_query`) will be included in the relation.
  *   `updatePartitionFilter` (*type:* `String.t`, *default:* `nil`) - A SQL expression conditional used to limit the set of existing rows considered for a merge operation (see `unique_key_parts` for more information).
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :incrementalPostOperations => list(String.t()) | nil,
          :incrementalPreOperations => list(String.t()) | nil,
          :incrementalSelectQuery => String.t() | nil,
          :refreshDisabled => boolean() | nil,
          :uniqueKeyParts => list(String.t()) | nil,
          :updatePartitionFilter => String.t() | nil
        }

  field(:incrementalPostOperations, type: :list)
  field(:incrementalPreOperations, type: :list)
  field(:incrementalSelectQuery)
  field(:refreshDisabled)
  field(:uniqueKeyParts, type: :list)
  field(:updatePartitionFilter)
end

defimpl Poison.Decoder, for: GoogleApi.Dataform.V1beta1.Model.IncrementalTableConfig do
  def decode(value, options) do
    GoogleApi.Dataform.V1beta1.Model.IncrementalTableConfig.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Dataform.V1beta1.Model.IncrementalTableConfig do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
